package platform.aio.server;

import platform.aio.ChannelInitializer;

import java.nio.ByteBuffer;
import java.nio.channels.AsynchronousSocketChannel;
import java.nio.charset.Charset;
import java.util.concurrent.TimeUnit;

public class AioServerChannelInitializer extends ChannelInitializer {

    @Override
    public void initChannel(AsynchronousSocketChannel channel) throws Exception {
        channel.read(ByteBuffer.allocate(1024),10, TimeUnit.SECONDS,null,new AioServerHandler(channel, Charset.forName("GBK")));
    }

    @Override
    public void completed(AsynchronousSocketChannel result, AioServer attachment) {

    }

    @Override
    public void failed(Throwable exc, AioServer attachment) {

    }
}
